package com.onlyyou.user.info;

import com.onlyyou.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author: 小野
 * @Date: 2020/1/13 10:44
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfo implements Serializable {
    private Long id;

    @NotBlank(message = "用户名不能为空")
    private String username;
    @NotBlank(message = "用户名不能为空")
    private String password;
    private Integer permission;
    private String phone;
    private Date createTime;
    private Date updateTime;

    public User buildInfo() {
        User user=new User();
        BeanUtils.copyProperties(this,user);
        return user;
    }

}
